import Taro, { Component } from '@tarojs/taro'
import { View, Button, Text } from '@tarojs/components'
import { connect } from '@tarojs/redux'

import './index.scss'
import { actions } from "../../mirror";

@connect(({ first }) => ({ ...first }))
class Index extends Component {

  config = {
    navigationBarTitleText: '首页'
  };

  componentWillReceiveProps(nextProps, nextContext) {
    console.log(this.props, nextProps)
  }

  componentWillUnmount() {
  }

  componentDidShow() {
  }

  componentDidHide() {
  }

  render() {
    return (
      <View className='index'>
        <Button className='add_btn' onClick={async () => await actions.first.addClick()}>+</Button>
        <Button className='dec_btn' onClick={async () => await actions.first.decClick()}>-</Button>
        <View><Text>{this.props.count}</Text></View>
        <View><Text>Hello, World</Text></View>
      </View>
    )
  }
}

export default Index
